package com.example.take_out_dish.controller;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.example.take_out_dish.common.Result;
import com.example.take_out_dish.entity.Category;
import com.example.take_out_dish.entity.Setmeal;
import com.example.take_out_dish.entity.SetmealDish;
import com.example.take_out_dish.service.SetmealDishService;
import com.example.take_out_dish.service.SetmealService;
import jakarta.annotation.Resource;
import lombok.extern.slf4j.Slf4j;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

/**
 * <p>
 * 套餐菜品关系 前端控制器
 * </p>
 *
 * @author yyyyys
 * @since 2024-07-01
 */
@Slf4j
@RestController
@RequestMapping("/setmealDish")
public class SetmealDishController {
    @Resource
    private SetmealDishService setmealDishService;
    @GetMapping("page")
    public Result<Page<SetmealDish>> page(int page, int pageSize){
        Page<SetmealDish> pageInfo= setmealDishService.page(new Page<>(page, pageSize));
        return Result.success(pageInfo);
    }
    @GetMapping("list")
    public Result<Object> dishList(@RequestParam("id") int id){
        List<SetmealDish> setmealDishes = setmealDishService.getDishById(id);
        return Result.success(setmealDishes);
    }



}
